package com.spring.config;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component //定时组件
public class ScheduledDemo {
    @Scheduled(cron = "0/2 * * * * ?")//是噶jo 偶的
    public void scheduledMethod() {
        System.out.println("定时器被触发：" + new Date());
    }

}
